#ifndef MINEDESIGN3D_LOGMANAGER
#define MINEDESIGN3D_LOGMANAGER
#include "Util/Singleton.hpp"

#include <boost/thread.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <fstream>
#include <string>
#include "Util/ThreadSafeBool.hpp"
namespace MineDesign3D{
class LogManager : public Util::Singleton<LogManager>
{
public:
	LogManager(const char* LogFilename);
	~LogManager();

	void Run();

	void BeginThread();
	void EndThread();

	void WriteLog(const char* Line);
private:
	boost::shared_ptr<boost::thread> m_pThread;
	Util::ThreadSafeBool m_endRequest;

		typedef std::vector<std::string> Log;
	Log m_logs;
	boost::mutex m_logsMutex;

	std::ofstream m_ofs;
};
}//MineDesign3D

inline MineDesign3D::LogManager* g_pLogManager()
{
	return MineDesign3D::LogManager::pInstance();
}
#endif